<template>
  <view class="info-list">
    <pane-card v-for="(item, index) in infoList" :key="index" :title="item.title" :sub-title="item.content">
    </pane-card>
    <v-empty :isShow="showEmpty" text="暂无相关记录"></v-empty>
  </view>
</template>
<script>
  import PaneCard from '@/components/m-card/pane-card.vue';
  import VEmpty from '@/components/v-empty/index.vue';
  import Api from '@/api/main';
  export default {
    components: {
      PaneCard,
      VEmpty
    },
    data() {
      return {
        showEmpty: false,
        infoList: [
          // {
          //   title: '标题',
          //   content: '2021-03-24 22:32'
          // },
          // {
          //   title: '标题',
          //   content: '2021-03-24 22:32'
          // }
        ]
      };
    },
    methods: {
      async getList(uid) {
        uni.showLoading({
          title: '加载中...'
        });
        const res = await this.$http.post(Api.getNotiveInfo, { uid });
        this.infoList = res || [];
        this.showEmpty = !this.infoList.length;
        uni.hideLoading();
      }
    },
    onLoad({ uid }) {
      this.getList(uid);
    }
  };
</script>
<style lang="scss">
  .info-list {
    width: 100%;
    padding: 20rpx 40rpx;

    img {
      width: 38rpx;
      height: 38rpx;
      margin-right: 8rpx;
    }

    .time,
    .message {
      display: flex;
      align-items: center;
    }
  }
</style>